import request from '@/utils/request'
import { SET_CHANNELS } from '@/store/actionTypes'

export const getChannels = () => {
  return async (dispatch) => {
    const res = await request({url:'/channels'})
    // dispatch 调用时底层会通知 reducers 

    console.log(res,'列表数据');
    dispatch({
      type: SET_CHANNELS,
      payload: res.data.channels
    })
  }
}